package yxy.game.pm2.command.infinite;

import yxy.cherry.game.base.message.MessageEmitterHandler;
import yxy.cherry.game.base.message.annotation.MessageSource;
import yxy.cherry.game.base.message.annotation.MessageType;
import yxy.game.pm2.Result;
import yxy.game.pm2.command.Command;
import yxy.game.pm2.message.InfiniteMessage;

/** 神将试炼 神将试炼排行榜膜拜 */
@MessageType(proto = Command.InfiniteRankWorship, classtype = InfiniteMessage.InfiniteRankWorshipRequest.class)
public class CMD_InfiniteRankWorship extends Command<InfiniteMessage.InfiniteRankWorshipRequest> {

	@Override
	public void execute(MessageSource messageSource, InfiniteMessage.InfiniteRankWorshipRequest request) {
		String playerCode = messageSource.getTag();
		// TODO 处理请求参数

		InfiniteMessage.InfiniteRankWorshipResponse.Builder response = InfiniteMessage.InfiniteRankWorshipResponse.newBuilder();

		// TODO 处理响应封装

		send(messageSource, response, Result.Success);
	}

	private void send(MessageSource messageSource, InfiniteMessage.InfiniteRankWorshipResponse.Builder response, Result result) {
		response.setResult(result.packResult());
		MessageEmitterHandler.getInstance().send(messageSource, response.build());
	}
}